#ifndef __TRACE_H__
#define __TRACE_H__

#include <stdio.h>

class Trace
{
    public:
        Trace() { noisy = 0; f = stdout; }
        Trace(FILE* ff) { noisy = 0; f = ff; }
        void on() { noisy = 1; }
        void off() { noisy = 0; }
        void print(const char* s) { if (noisy) fprintf(f, "%s", s); }
        void error(const char*s) {
            if (noisy) fprintf(f, "[%s:%d]%s", __func__, __LINE__, s); 
        }
    
    private:
        int noisy;
        FILE* f;
};

#endif
